package com.hspedu.date_;

import java.sql.Date;
import java.time.Instant;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/2/5
 * @time 17:31
 */
public class Instant_ {
    public static void main(String[] args) {
        Instant instant = Instant.now();
        System.out.println(instant);
        //通过from把Instant转成Date
        java.util.Date from = Date.from(instant);
        System.out.println(from);

        //通过date的toInstant()可以把date转成Instant对象
        Instant now = from.toInstant();
        System.out.println(now);
    }
}
